package com.rv.nats.resolver.reply;

import com.rv.nats.enums.ClientType;
import io.nats.client.Message;

import java.io.IOException;
import java.lang.reflect.Type;

/**
 * @author SunDeZhi
 * @time 2023/8/1
 * @description :
 */
public class BytesResolver implements ReplyResolver {
    @Override
    public boolean match(ClientType clientType) {
        return false;
    }

    @Override
    public byte[] convertResult(Message message, Class<?> returnType) {
        return message.getData();
    }

    /**
     * @param message
     * @param returnType
     * @return
     * @throws IOException
     */
    @Override
    public Object convertResult(Message message, Type returnType) throws IOException {
        return message.getData();
    }
}
